// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.nnee.p_pr.p_a;

import android.content.Context;
import android.net.Uri;
import android.text.TextUtils;
import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;

public class cls_f
{

    public cls_f()
    {
    }

    public static Uri a(File file)
    {
        Uri uri;
        if(file != null)
            uri = Uri.fromFile(file);
        else
            uri = null;
        return uri;
    }

    public static File a(Uri uri)
    {
    	File file = null;
        if(uri == null) {
        	file = null;
        } else
        {
        	 String s = uri.getPath();
             if(s == null) {
            	 file = null;
             }else 
             {
            	 file = new File(s);
             }
        }

        return file;

    }

    public static File a(File file, String s)
    {
        return a(file.getAbsolutePath(), s);
    }

    public static File a(String s, String s1)
    {
        String s2 = "/";
        if(s.endsWith("/"))
            s2 = "";
        return new File((new StringBuilder()).append(s).append(s2).append(s1).toString());
    }

    public static String a(Context context, long l)
    {
        String s;
        s = null;
        if(b == null)
            a();
        String s1=null;
        Method method = b;
        Object aobj[] = new Object[2];
        aobj[0] = context;
        aobj[1] = Long.valueOf(l);
        try {
			s1 = (String)method.invoke(null, aobj);
		} catch (IllegalArgumentException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InvocationTargetException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        if(s1 == null)
            s1 = (new StringBuilder()).append(Long.toString(l / 1024L)).append("KB").toString();

        return s1;
//        Exception exception1;
//        exception1;
//        exception1.printStackTrace();
//        Exception exception;
//        if(s == null)
//            s1 = (new StringBuilder()).append(Long.toString(l / 1024L)).append("KB").toString();
//        else
//            s1 = s;
//        continue; /* Loop/switch isn't completed */
//        exception;
//        if(s == null)
//            s = (new StringBuilder()).append(Long.toString(l / 1024L)).append("KB").toString();
//        s1 = s;
//        if(true) goto _L2; else goto _L1
//_L1:
    }

    private static void a()
    {
        
        Class aclass[] = new Class[2];
        aclass[0] = android.content.Context.class;
        aclass[1] = Long.TYPE;
        try {
			b = Class.forName("android.text.format.Formatter").getMethod("formatFileSize", aclass);
		} catch (SecurityException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (NoSuchMethodException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

        return;

    }

    public static boolean a(File file, File file1)
    {
        boolean flag = false;
        try
        {
            FileInputStream fileinputstream = new FileInputStream(file1);
            FileOutputStream fileoutputstream = new FileOutputStream(file);
            byte abyte0[] = new byte[1024];
            do
            {
                int i = fileinputstream.read(abyte0);
                if(i <= 0)
                {
                    fileoutputstream.close();
                    fileinputstream.close();
                    flag = true;
                    break;
                }
                fileoutputstream.write(abyte0, 0, i);
            } while(true);
        }
        catch(Exception exception)
        {
            exception.printStackTrace();
        }
        return flag;
    }

    public static boolean a(File file, List list)
    {
        if(file.exists())
        {
            File afile[] = file.listFiles();
            if(afile != null && afile.length > 0)
            {
                int i = 0;
                while(i < afile.length) 
                {
                    if(afile[i].isDirectory())
                        a(afile[i], list);
                    else
                    if(!list.contains(afile[i].getPath()))
                        afile[i].delete();
                    afile[i] = null;
                    i++;
                }
            }
        }
        return true;
    }

    public static boolean a(String s)
    {
        boolean flag;
        if(s != null && !s.startsWith("http://"))
            flag = true;
        else
            flag = false;
        return flag;
    }

    public static boolean a(String s, int i)
    {
        boolean flag;
        if(TextUtils.isEmpty(s))
            flag = false;
        else
            flag = true;
        return flag;
    }

    public static File b(File file)
    {
        if(file != null)
        {
            if(!file.isDirectory())
            {
                String s = file.getName();
                String s1 = file.getAbsolutePath();
                String s2 = s1.substring(0, s1.length() - s.length());
                if(s2.endsWith("/"))
                    s2 = s2.substring(0, -1 + s2.length());
                file = new File(s2);
            }
        } else
        {
            file = null;
        }
        return file;
    }

    public static String b(String s)
    {
        String s1;
        if(s == null)
        {
            s1 = null;
        } else
        {
            int i = s.lastIndexOf(".");
            if(i >= 0)
                s1 = s.substring(i);
            else
                s1 = "";
        }
        return s1;
    }

    public static boolean c(File file)
    {
    	boolean flag = true;
        if(!file.exists()) {
        	 flag = file.delete();
        } else 
        {
        File afile[] = file.listFiles();
        if(afile != null && afile.length > 0) 
        {
        	int i = 0;
            while(i < afile.length) 
            {
                if(afile[i].isDirectory())
                    c(afile[i]);
                else
                    afile[i].delete();
                afile[i] = null;
                i++;
            }
        }
        }

        return flag;

    }

    public static boolean c(String s)
    {
        boolean flag;
        if(s.startsWith(android.provider.MediaStore.Audio.Media.INTERNAL_CONTENT_URI.toString()) || s.startsWith(android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI.toString()) || s.startsWith(android.provider.MediaStore.Video.Media.INTERNAL_CONTENT_URI.toString()) || s.startsWith(android.provider.MediaStore.Video.Media.EXTERNAL_CONTENT_URI.toString()))
            flag = true;
        else
            flag = false;
        return flag;
    }

    public static int d(File file)
    {
        int i = 0;
        if(file != null && file.exists())
        {
            String as[] = file.list();
            if(as != null)
                i = as.length;
        }
        return i;
    }

    public static long e(File file)
    {
        long l = 0L;
        int i = 0;
        if(file != null && file.exists())
        {
            String as[] = file.list();
            int j;
            if(as == null)
                j = i;
            else
                j = as.length;
            if(j > 0)
                while(i < j) 
                {
                    File file1 = new File(file, as[i]);
                    as[i] = null;
                    if(file1.isDirectory())
                        l += e(file1);
                    else
                        l += file1.length();
                    i++;
                }
        }
        return l;
    }

    static final String a = "FileUtils";
    static Method b = null;

}
